<%@ page contentType="text/html; charset=UTF-8" language="java"%>
<%@ page import="com.hzqy.commons.utils.ConstantUtils" %>
<%@ page import="com.hzqy.web.vo.PmsUserVo"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>节目增加</title>
<link rel="stylesheet" type="text/css"	href="../../static/js/themes/defalut.css">
<link rel="stylesheet" type="text/css"	href="../../static/js/themes/public.css">
<link rel="stylesheet" type="text/css"	href="../../static/js/themes/ddspstyle.css">
<link rel="stylesheet" type="text/css"	href="../../static/js/themes/default/easyui.css">
<link rel="stylesheet" type="text/css"	href="../../static/js/themes/icon.css">
<link rel="stylesheet" type="text/css"	href="../../static/js/WdatePicker/skin/WdatePicker.css">
<script type="text/javascript" src="../../static/js/jquery.min.js"></script>
<script type="text/javascript" src="../../static/js/jquery.easyui.min.js"></script>
<script type="text/javascript"	src="../../static/js/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="../../static/js/jquery.validate.js"></script>
<script type="text/javascript" src="../../static/js/index.js"></script>
<script type="text/javascript" src="../../static/js/WdatePicker/WdatePicker.js"></script>
<script type="text/javascript" charset="utf-8" src="../../ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="../../ueditor/ueditor.all.min.js"></script>
<script type="text/javascript" charset="utf-8" src="../../ueditor/lang/zh-cn/zh-cn.js"></script>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<%
PmsUserVo vo=((PmsUserVo)session.getAttribute("SESSION_USER"));
String userName="";
int status=2;
if(vo!=null){
	userName=vo.getF_pu_name();
	if(vo.getRoleIds().equals("2")||vo.getRoleIds().equals("1")){//省公司
		status=1;
	}else if(vo.getRoleIds().equals("3")){//市公司
		status=16;
	}
}
String []nonceObj=ConstantUtils.getNonceObject();
%>
<script type="text/javascript">
	$(function() {
		$("#contentForm").validate({
			rules: {
				f_cc_name: {
					required: true,
					minlength: 1,
					maxlength: 50
				},
				f_cc_companyname: {
					required: true
				}
				
				
			},
			messages: {
				f_cc_name: {
					required: "请输入节目名称",
					minlength: "节目名称不能少于1位",
					maxlength: "节目名称不能超过50位"
				},
				f_cc_companyname: {
					required: "请选择组织",
				}
			}
			
		});
		
		try{
			var ue = UE.getEditor('f_cc_desc');
		}catch(e){
			console.info(e);
		}
		moreItemSwitch()
		$("#f_cc_seriescount").val(1);
		$("#f_cc_obligate3").val(0);
		$("#f_cc_obligate4").val(0);
		$("#f_cc_medioCommonFlag_").change(function(){
			if($(this).is(':checked')){
			　　　$("#f_cc_medioCommonFlag").attr('value','2');
			}else{
				$("#f_cc_medioCommonFlag").attr('value','1');
			}
		});
		$("#f_cc_transcodeFlag_").change(function(){
			if($(this).is(':checked')){
			　　　$("#f_cc_transcodeFlag").attr('value','1');
			}else{
				$("#f_cc_transcodeFlag").attr('value','0');
			}
		});
		
	});

	function _submitFm() {
		if(document.getElementById("isfree").checked){
			document.getElementById("f_cc_isfree").value = 1;
		}
		var definitionflag = 0;
		$('input[name="definitionflag"]').each(function(idx, ele){
			definitionflag += $(this).is(':checked')?parseInt($(this).val()):0;
		});
		$('#f_cc_definitionflag').val(definitionflag);
		 arrayToJson();
		if($("#contentForm").validate().form()) {
		app_ajax('../../content/insert_content.do', $("#contentForm").serialize(), function(data) {
				if (data.success) {
					$.messager.progress('close');
					$.messager.alert('提示', '提交成功！', 'info', function() {
						parent.$('#dlg').dialog('close');
						parent.gotoSearch($('#easyui-treegrid'));
					});
				} else {
					$.messager.alert('提示', data.result, 'info', function() {
						$.messager.progress('close');
					});
				}
		}); 
	  }
	}
	
	var open = true;
	function moreItemSwitch(){
		if(open){
			$(".more_attr_hide").hide();
			$("#switchItemBtn").find(".l-btn-text").text("显示更多节目");
			$("#switchItemBtn").find(".l-btn-icon.icon-remove").removeClass("icon-remove").addClass("icon-add");
		}else{
			$(".more_attr_hide").show();
			$("#switchItemBtn").find(".l-btn-text").text("隐藏更多节目");
			$("#switchItemBtn").find(".l-btn-icon.icon-add").removeClass("icon-add").addClass("icon-remove");
		}
		open = !open;
	}
	function castSelect(id){
		openDialog($('#cast_list'),'content_cast.jsp?id='+id);
	}
	
	function bind() {
		openDialog($('#org_list'),'../behavior_control/org_update.jsp?idField=f_cc_company_id&nameField=f_cc_company_name');
		//openDialog($('#dlg'),'org_bind.jsp?chooseid='+$("#f_cc_company_id").val());
	}

	function category_bind() {
		openDialog($('#dlg'),'content_bind.jsp');
	}
</script>
<style type="text/css">
</style>
</head>

<body class="overfwidth">
	<div class="barnavtop">您所在的位置：节目管理 &gt; 节目新增</div>
	<div id="workspace">
		<!--主体 开始-->
		<div id="container-1">
			<div class="editspace">
				<form id="contentForm" class="cmxform" enctype="multipart/form-data" name="formName">
					<input type="hidden" id="f_cc_isfree" name="f_cc_isfree" value="0"/>
					<input type="hidden" id="f_cc_definitionflag" name="f_cc_definitionflag" value=""/>
					<input type="hidden" id="f_cc_viewindex" name="f_cc_viewindex" value="0"/>
					<input type="hidden" id="f_cc_status" name="f_cc_status" value="<%=status%>"/>
					<input type="hidden" id="sourceFlag" name="sourceFlag" value="5"/>
					<input type="hidden" id="f_cast_id" name="f_cast_id" value=""/>
					<legend style="text-align: center; margin: 0 auto;">节目新增</legend>
										<input id="f_cc_programatype" name="f_cc_programatype" type="hidden" value="1" />
					<!-- <a id="switchItemBtn" class="easyui-linkbutton" style="position: fixed; top: 70px; right: 0; background: #D2E0F2; border: 1px solid #95B8E7;" data-options="iconCls:'icon-remove'" plain="true" href="javascript:moreItemSwitch();">隐藏更多节目</a> -->
					<fieldset>
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="20%" align="right">
										<span class="red">*</span>节目名称:
									</td>
									<td width="30%">
										<input id="f_cc_name" name="f_cc_name" style="width: 150px;" value="" class="yl_inp yw_name" />
										<span id="f_cc_name_tip" class="tip"></span>
									</td>
									<td width="20%" align="right">
										分类绑定:
									</td>
									<td width="30%" colspan="3">
										<input readonly="readonly" id="bind_categoryName"	style="width: 150px;" value=""  class="yl_inp yw_name" />
										
										<input name="bind_categoryDelStr" id="bind_categoryDelStr" type="hidden" value="" />
										<input name="bind_categoryInStr" id="bind_categoryInStr" type="hidden" value="" />  
										<a id="12" class="easyui-linkbutton" data-options="iconCls:'icon-ok'" href="javascript:void(0);"
											onclick="category_bind();">选择</a>
									</td>
								</tr>
							</table>
						</div>
					</fieldset>
				
				
						
					<fieldset>
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="20%" align="right">
										&nbsp;节目类型:
									</td>
									<td width="30%">
										<select id="f_cc_type" name="f_cc_type" style="width: 150px;">
											<option value="4">图文</option>
											<option value="3">直播</option>
											<option value="5">链接</option>
											<!-- <option value="10">通知</option> -->
											<option value="110">通知</option>
										</select>
									</td>
									<td width="20%" align="right">
										<span class="red">*</span>组织选择:
									</td>
									<td width="30%">
										<input name="f_cc_companyname" id="f_cc_company_name" readonly="readonly"	style="width: 150px;" value="" class="yl_inp yw_name" />
										<input name="f_cc_companyid" id="f_cc_company_id" type="hidden" value="" />  
										<input name="status" id="status" type="hidden" value="nochange" />  
										<!-- <select id="f_cc_companyid" name="f_cc_companyid" style="width: 150px;">
										</select> -->
										<!-- <span id="f_cc_companyid_tip" class="tip"></span> -->
										<a id="12" class="easyui-linkbutton" data-options="iconCls:'icon-ok'" href="javascript:void(0);"
											onclick="bind();">选择</a>
									</td>
								</tr>
							</table>
						</div>
					</fieldset>
					<fieldset>
						<div class="fitem hide-item">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="20%" align="right">
										预留字段1:
									</td>
									<td width="30%">
										<textarea id="f_cc_obligate1" name="f_cc_obligate1" style="width: 150px; height: 50px;"></textarea>
									</td>
									<td width="20%" align="right">
										预留字段2:
									</td>
									<td width="30%">
										<textarea id="f_cc_obligate2" name="f_cc_obligate2" style="width: 150px; height: 50px;"></textarea>
									</td>
								</tr>
							</table>
						</div>
					</fieldset>
					<fieldset>
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="20%" align="right">
										CPID:
									</td>
									<td width="30%">
										<input style="width: 150px;" name="f_cc_cpid" id="f_cc_cpid" value="" class="yl_inp yw_name" />
									</td>
									<td width="20%" align="right">
									</td>
									<td width="30%">
									</td>
								</tr>
							</table>
						</div>
					</fieldset>
					<div class="more_attr_hide">
					<fieldset>
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="20%" align="right">
										预留字段3:
									</td>
									<td width="30%">
										<input id="f_cc_obligate3" name="f_cc_obligate3" value="" style="width: 150px;" class="yl_inp yw_name"></input>
										<span id="f_cc_obligate3_tip" class="tip"></span>
									</td>
									<td width="20%" align="right">
										预留字段4:
									</td>
									<td width="30%">
										<input id="f_cc_obligate4" name="f_cc_obligate4" value="" style="width: 150px;" class="yl_inp yw_name"></input>
										<span id="f_cc_obligate4_tip" class="tip"></span>
									</td>
								</tr>
							</table>
						</div>
					</fieldset>
					<fieldset>
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td class="hide-item" width="20%" align="right">
										&nbsp;云转码输出:
									</td>
									<td class="hide-item" width="30%">
										<select id="f_cc_outputType" name="f_cc_outputType" style="width: 150px;">
										<option value="1">720*576</option>
										<option value="2">1280*720</option>
										<option value="3">1920*1080</option>
										</select>
									</td>
									<td width="20%" align="right">
										是否转码:
									</td>
									<td width="30%">
										<input type="checkbox" id="f_cc_transcodeFlag_"	style="width: 150px;"  />
										<input name="f_cc_transcodeFlag" id="f_cc_transcodeFlag" type="hidden" value="0" />  
									</td>
								</tr>
							</table>
						</div>
					</fieldset>
						<fieldset>
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="20%" align="right">
										接口类型:
									</td>
									<td width="30%">
										<select name="f_cc_interfaceType" id="f_cc_interfaceType" style="width: 150px;">
										<option value="0">请选择</option>
										<option value="1">华为中兴</option>
										<option value="2">中兴</option>
										<option value="3">华为</option>
										</select>
									</td>
									<td class="hide-item" width="20%" align="right">
										&nbsp;视频属性:
									</td>
									<td class="hide-item" width="30%">
										<select id="f_cc_medioType" name="f_cc_medioType" style="width: 150px;">
										<option value="1">戏曲</option>
										<option value="2">党建</option>
										<option value="3">教育</option>
										<option value="4">其他</option>
										<option value="5">体育</option>
										<option value="6">美食</option>
										<option value="7">娱乐</option>
										<option value="8">医疗</option>
										<option value="9">新闻</option>
										<option value="10">企业宣传 </option>
										</select>
									</td>
								</tr>
							</table>
						</div>
					</fieldset>
					<fieldset>
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="20%" align="right">
										CPID:
									</td>
									<td width="30%">
										<!-- <input style="width: 150px;" name="f_cc_cpid" id="f_cc_cpid" value="" class="yl_inp yw_name" /> -->
									</td>
									<td width="20%" align="right">
										是否共享:
									</td>
									<td width="30%">
										<input type="checkbox" id="f_cc_medioCommonFlag_"	style="width: 150px;"  />
										<input name="f_cc_medioCommonFlag" id="f_cc_medioCommonFlag" type="hidden" value="1" />  
									</td>
								</tr>
							</table>
						</div>
					</fieldset>
					
					<fieldset>
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									
									<td width="20%" align="right">
										&nbsp;时长:
									</td>
									<td width="30%" align="left">
										<input id="f_cc_duration" name="f_cc_duration" style="width: 150px;" value="" class="yl_inp yw_name" />
										<span id="f_cc_duration_tip" class="tip"></span>
									</td>
									<td  width="20%"></td>
									<td width="30%" ></td>
								</tr>
							</table>
						</div>
					</fieldset>
					
					
					<fieldset>
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td class="hide-item" width="20%" align="right">
										&nbsp;查询名称:
									</td>
									<td class="hide-item" width="30%">
										<input id="f_cc_searchname" name="f_cc_searchname" style="width: 150px;" value="" class="yl_inp yw_name" />
										<span id="f_cc_searchname_tip" class="tip"></span>
									</td>
									<td class="hide-item" width="20%" align="right">
										&nbsp;标签:
									</td>
									<td class="hide-item" width="30%">
										<input id="f_cc_tags" name="f_cc_tags" style="width: 150px;" value="" class="yl_inp yw_name" />
										<span id="f_cc_tags_tip" class="tip"></span>
									</td>
								</tr>
							</table>
						</div>
					</fieldset>
					
					<fieldset>
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td class="hide-item" width="20%" align="right">
										&nbsp;播放CODE:
									</td>
									<td class="hide-item" width="30%">
										<input id="f_cc_mediacode" name="f_cc_mediacode" style="width: 150px;" value="" class="yl_inp yw_name" />
										<span id="f_cc_mediacode" class="tip"></span>
									</td>
									<td class="hide-item" width="20%" align="right">
										&nbsp;导演:
									</td>
									<td class="hide-item" width="30%">
											<input id="f_cc_director" name="f_cc_director" style="width: 150px;" value="" class="yl_inp yw_name" />
										<span id="f_cc_director_tip" class="tip"></span>
										<!-- <a id="12" class="easyui-linkbutton" data-options="iconCls:'icon-ok'" href="javascript:void(0);"
											onclick="castSelect(3)">选择</a> --></td>
									</td>
								</tr>
							</table>
						</div>
					</fieldset>
					
					<fieldset>
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="20%" align="right">
										上线时间:
									</td>
									<td width="30%">
										<input id="f_cc_onlinedate" name="f_cc_onlinedate" type="text" onClick="WdatePicker({skin:'default',dateFmt: 'yyyy-MM-dd HH:mm:ss'})" style="width: 150px;" value="2011-01-01 01:01:01" class="yl_inp yw_name" />
										<span id="f_cc_onlinedate" class="tip"></span>
									</td>
									<td class="hide-item" width="20%" align="right">
										&nbsp;演员列表:
									</td>
									<td class="hide-item" width="30%">
										<input id="f_cc_actors" name="f_cc_actors" style="width: 150px;" value="" class="yl_inp yw_name" />
										<span id="f_cc_actors_tip" class="tip"></span>
										<!-- <a id="12" class="easyui-linkbutton" data-options="iconCls:'icon-ok'" href="javascript:void(0);"
											onclick="castSelect(2)">选择</a> --></td>
									</td>
								</tr>
							</table>
						</div>
					</fieldset>
					
					<fieldset>
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="20%" align="right">
										下线时间:
									</td>
									<td width="30%">
										<input id="f_cc_offlinedate" name="f_cc_offlinedate" type="text" onClick="WdatePicker({skin:'default',dateFmt: 'yyyy-MM-dd HH:mm:ss'})" style="width: 150px;" value="2111-01-01 01:01:01" class="yl_inp yw_name" />
										<span id="f_cc_offlinedate" class="tip"></span>
									</td>
									<td class="hide-item" width="20%" align="right">
										&nbsp;编剧:
									</td>
									<td class="hide-item" width="30%">
										<input id="f_cc_screenwriter" name="f_cc_screenwriter" style="width: 150px;" value="" class="yl_inp yw_name" />
										<span id="f_cc_screenwriter_tip" class="tip"></span>
										<!-- <a id="12" class="easyui-linkbutton" data-options="iconCls:'icon-ok'" href="javascript:void(0);"
											onclick="castSelect(1)">选择</a> --></td>
									</td>
								</tr>
							</table>
						</div>
					</fieldset>
					
					<fieldset>
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="20%" align="right">
										&nbsp;节目Code:
									</td>
									<td width="30%">
										<input id="f_cc_code" name="f_cc_code" style="width: 150px;" value="" class="yl_inp yw_name" />
										<span id="f_cc_code_tip" class="tip"></span>
									</td>
									<td class="hide-item" width="20%" align="right">
										<span class="red">*</span>总集数:
									</td>
									<td class="hide-item" width="30%">
										<input id="f_cc_seriescount" name="f_cc_seriescount" style="width: 150px;" value="" class="yl_inp yw_seriescount" />
									</td>
								</tr>
							</table>
						</div>
					</fieldset>
					
					
					<fieldset class="hide-item">
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="20%" align="right">
										是否免费:
									</td>
									<td width="30%">
										<input id="isfree" name="isfree" type="checkbox" style="width: 18px; height: 18px; line-height: 18px; border: #AEAEAC solid 1px; vertical-align: middle;"/>免费
									</td>
									<td class="hide-item" width="20%" align="right">
										&nbsp;完结状态:
									</td>
									<td class="hide-item" width="30%">
										<select id="f_cc_end" name="f_cc_end" style="width: 150px;">
				                    		<option value="0">未完结</option>
				                    		<option value="1">完结</option>
				                    	</select>									
									</td>
								</tr>
							</table>
						</div>
					</fieldset>
					
					
<!-- 					<fieldset>
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="20%" align="right">
										&nbsp;清晰度:
									</td>
									<td width="30%">
										<input type="checkbox" id="definition_sd" name="definitionflag" value="1"/><label for="definition_sd" style="width: 60px;">720x576</label>
										<input type="checkbox" id="definition_phd" name="definitionflag" value="10"/><label for="definition_phd" style="width: 60px;">1280x720</label>
										<input type="checkbox" id="definition_hd" name="definitionflag" value="100"/><label for="definition_hd" style="width: 60px;">1920x1080</label>
									</td>
								</tr>
							</table>
						</div>
					</fieldset> -->
					</div>
					
					<fieldset>
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="40%" align="right">
										<jsp:include page="../../pictures/pictures_add_industry.jsp" flush="true">
											<jsp:param value="内容" name="picType"/>
										</jsp:include>
									</td>
								</tr>
							</table>
						</div>
					</fieldset>
						<fieldset>
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="40%" align="center">
									 提醒建议：标清终端单图100KB以下，高清终端单图300K以下。否则可能会出现终端设备无法显示图片或其它异常现象。
									</td>
								</tr>
							</table>
						</div>
					</fieldset>
					<fieldset>
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="15%" align="right">
										&nbsp;节目简介:
									</td>
									<td width="85%">
										<textarea id="f_cc_desc" name="f_cc_desc" style="width: 95%; height: 350px;">
										</textarea>
										<span id="f_cc_desc_tip" class="tip"></span>
									</td>
								</tr>
							</table>
						</div>
					</fieldset>
					<input type="hidden" name="stime" value="<%=nonceObj[0]%>"/>
					<input type="hidden" name="sign" value="<%=nonceObj[1]%>"/>
					<div class="toolbar" style="text-align: center;">
						<a class="easyui-linkbutton" data-options="iconCls:'icon-ok'"
							href="javascript:void(0);" onclick="_submitFm()">保存</a> <a
							href="javascript:void(0);" data-options="iconCls:'icon-cancel'"
							class="easyui-linkbutton"
							onclick="javascript:parent.$('#dlg').dialog('close')">取消</a>
					</div>
				</form>
			</div>
		</div>
		<!--主体 结束-->
		
		
	</div>
	<div id="cast_list" class="easyui-dialog"
		style="width: 600px; height: 470px; padding-top: 0px;"
		data-options="title:'模型选择', iconCls:'icon-save',modal:true,closed:true,buttons:'#dlg_buttons'">
		<iframe scrolling="auto" frameborder="0"
			style="width: 100%; height: 99%;"></iframe>
	</div>
	<div id="dlg" class="easyui-dialog"
		style="width: 800px; height: 500px; padding-top: 0px;"
		data-options="title:'企业管理', iconCls:'icon-save',modal:true,closed:true,buttons:'#dlg_buttons'">
		<iframe scrolling="auto" frameborder="0"
			style="width: 100%; height: 99%;"></iframe>
	</div>
	<div id="org_list" class="easyui-dialog"
		style="width: 800px; height: 500px; padding-top: 0px;"
		data-options="title:'客户选择', iconCls:'icon-save',modal:true,closed:true,buttons:'#dlg_buttons'">
		<iframe scrolling="auto" frameborder="0"
			style="width: 100%; height: 99%;"></iframe>
	</div>
</body>
</html>
